package com.example.volunteer.controller;


import com.example.volunteer.dto.LoginDTO;
import com.example.volunteer.dto.LoginResponse;
import com.example.volunteer.dto.RegisterDTO;
import com.example.volunteer.service.AuthService;
import com.example.volunteer.util.Result;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/auth")
public class AuthController {

    @Autowired
    private AuthService authService;

    @PostMapping("/login")
    public String login(@RequestBody @Valid LoginDTO loginDTO) {
        return authService.login(loginDTO);
    }

    @PostMapping("/register")
    public void register(@RequestBody RegisterDTO registerDTO) {
        authService.register(registerDTO);
    }
}
